<template>
	<view class="list-view">
		<view class="top-bar"><uni-navbar :fixed="true" :back="true" color="#fff" title="书香人大"></uni-navbar></view>

		<view class="u-line"></view>
		<u-row class="link-box" gutter="0" align="top">
			<u-col span="4">
				<navigator hover-class="none" class="link-item" url="/pagesA/bbq/list?dict=sxzx_article_classification">
					<image :src="$staticImgRandom('/static/img/bbq_index01.png')" mode="aspectFill"></image>
					书香人大
				</navigator>
			</u-col>
			<u-col span="4">
				<navigator hover-class="none" class="link-item" url="/pagesA/bbq/list?dict=online_study_type">
					<image :src="$staticImgRandom('/static/img/bbq_index02.png')" mode="aspectFill"></image>
					在线学习
				</navigator>
			</u-col>
			<!-- <u-col span="4" v-for="(item, index) in links" :key="index">
				<view class="link-item" @click="navTo(item.link)">
					<image :src="linksImg(item.fileRepositorylist)" mode="aspectFill"></image>
					<view class="clamp">{{ item.name }}</view>
				</view>
			</u-col> -->
		</u-row>

		<!-- <view class="container">尊敬的读者朋友，外部链接请复制后使用浏览器打开。</view> -->
	</view>
</template>

<script>
import { mapState } from 'vuex';
export default {
	data() {
		return {
			// links: []
		};
	},
	onLoad() {
		this.loadLogin();
		// this.loadLinks();
	},
	computed: {
		...mapState(['userInfo'])
	},
	methods: {
		loadLogin() {
			if (this.userInfo.sysUser) {
				this.clientCode = this.userInfo.sysUser.clientCode;
				this.userId = this.userInfo.sysUser.id;
			} else {
				this.clientCode = '370702';
				// this.$logout();
			}
		},
		loadLinks() {
			let data = {
				pageNum: '1',
				pageSize: '99999',
				link: {
					clientCode: this.clientCode,
					isShow: '1'
				}
			};
			this.$request('/shuxiangzhengxie/link/list', data).then(res => {
				this.links = res.data.records;
			});
		},
		navTo(url) {
			uni.setClipboardData({
				data: url,
				success: () => {
					console.log('success');
				}
			});
		},
		linksImg(item) {
			if (item && item.length > 0) {
				return this.$baseUrl + '/file/download/preview/0?path=' + item[0].path.replace('\\', '-');
			} else {
				return this.$staticImgRandom('/static/img/default_big.png');
			}
		}
	}
};
</script>

<style lang="scss">
.pro-row {
	.pro-title {
		margin-bottom: 20rpx;
		font-size: 15px;
		color: #e5231a;
	}
}

.link-box {
	.link-item {
		display: block;
		color: #333;
		text-decoration: none;

		.text {
			font-size: 17px;
			color: #fff;
			position: relative;
			top: 120rpx;
			z-index: 1;
		}

		image {
			width: 188rpx;
			height: 240rpx;
			border-radius: 12rpx;
		}
	}
}
</style>
